﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Manager/Base.Master" AutoEventWireup="true" CodeBehind="DepartList.aspx.cs" Inherits="YXQ.Manager.Manager.DepartList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        $(function () {
            $('#dg').datagrid({
                title: '部门列表',
                iconCls: 'icon icon-nav',
            height: 420,
            nowrap: true,
            autoRowHeight: false,
            striped: true,
            url: "../Handler/DataHandler.ashx?OpType=GetDepart",
            sortOrder: 'desc',
            remoteSort: false,
            pagination: true,
            columns: [[
					{ field: 'Id', title: 'ID', width: 80 },
					{ field: 'DepartName', title: '部门名称', width: 300 }, 
                    { field: 'DepartNum', title: '部门编号', width: 300 },
                    { field: 'opt', title: '操作', width: 200, align: 'center',
                        formatter: function (value, rec) {
                            return "<a href='javascript:' onclick='Edit(" + rec.Id + ")'>编辑</a>&nbsp;&nbsp;<a href='javascript:' onclick='Del(" + rec.Id + ")'>删除</a>";
                        }
                    }
            ]],
            toolbar: [{
                id: 'btnadd',
                text: '添加',
                iconCls: 'icon-add',
                handler: function () 
                {
                    YXQ.Manager.OpenDialog("DepartDetail.aspx", "添加部门", 300,200);
                }
            }]
        });

        });



        function Edit(val) {
            YXQ.Manager.OpenDialog("DepartDetail.aspx?id=" + val, "修改部门", 300, 200);
        }


        function Del(val) {
            YXQCore.Form.PostData("../Handler/CommonHandler.ashx",
                                { OpType: "DelDep", PostData: val },
                                function (data) {
                                    if (data.ResultMessage == "Success") {
                                        YXQ.Common.Message("恭喜你操作已经成功");
                                        $("#dg").datagrid("reload");
                                        return;
                                }
            });
        }
		function SearDepart(){
			 $('#dg').datagrid('load', {
			     depart: $('#txtDepartName').val()
            
        });
		}
    </script>
    <table cellspacing="0" cellpadding="0" width="100%" class="admintable">
        <tr>
            <td>
                <table cellspacing="0" cellpadding="0" class="admintable01">
                    <tr>
                        <td style="width: 20px;">
                            <img src="../images/carfromtable_01.gif" style="margin-top: 2px;" />
                        </td>
                        <td>
                            <b>位置：</b>部门管理
                        </td>
                        <td style="width: 50px;"></td>
                        <td style="width: 50px;"></td>
                        <td style="width: 15px;"></td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td height="10"></td>
        </tr>
        </table> 
     <table class="tbs_table">
        <tr>
            <td class="tdtitle">部门名称：</td>
             <td class="tdtitle"><input type="text"  id="txtDepartName" /></td>
             
             <td class="tdtitle"><input type="button"  class="bt_wb1"  value="搜索"  onclick="SearDepart();"/></td>
        </tr>
    </table>

     <table id="dg">
    </table>
</asp:Content>
